<!--
	Copyright 2009 The Go Authors. All rights reserved.
	Use of this source code is governed by a BSD-style
	license that can be found in the LICENSE file.
-->
<!--
	Note: Static (i.e., not template-generated) href and id
	attributes start with "pkg-" to make it impossible for
	them to conflict with generated attributes (some of which
	correspond to Go identifiers).
-->

	
		<div id="short-nav">
			<dl>
			<dd><code>import "intermernet/scryptauthlib"</code></dd>
			</dl>
			<dl>
			<dd><a href="#pkg-overview" class="overviewLink">Overview</a></dd>
			<dd><a href="#pkg-index">Index</a></dd>
			
			
			
			</dl>
		</div>
		<!-- The package's Name is printed as title by the top-level template -->
		<div id="pkg-overview" class="toggleVisible">
			<div class="collapsed">
				<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2>
			</div>
			<div class="expanded">
				<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2>
				
			</div>
		</div>
		
	
		<h2 id="pkg-index">Index</h2>
		<!-- Table of contents for API; must be named manual-nav to turn off auto nav. -->
		<div id="manual-nav">
			<dl>
			
				<dd><a href="#pkg-constants">Constants</a></dd>
			
			
			
				
				<dd><a href="#Check">func Check(hmk, h, pw, s []byte) (chk bool, err error)</a></dd>
			
				
				<dd><a href="#New">func New(hmk, pw []byte) (h, s []byte, err error)</a></dd>
			
			
			
		</dl>

		

		
			<h4>Package files</h4>
			<p>
			<span style="font-size:90%">
			
				<a href="/target/scryptauthlib.go">scryptauthlib.go</a>
			
			</span>
			</p>
		
	
		
			<h2 id="pkg-constants">Constants</h2>
			
				<pre>const (
    <span class="comment">// Key length and salt length will be 32 bytes (256 bits)</span>
    KEYLENGTH = 32

    <span class="comment">// &#34;N is a CPU/memory cost parameter, which must be a power of two greater than 1.</span>
    <span class="comment">// r and p must satisfy r * p &lt; 2³⁰. If the parameters do not satisfy the</span>
    <span class="comment">// limits, the function returns a nil byte slice and an error.&#34;</span>
    <span class="comment">// From http://code.google.com/p/go/source/browse/scrypt/scrypt.go?repo=crypto</span>
    N = 16384
    R = 8
    P = 1
)</pre>
				
			
		
		
		
			
			
			<h2 id="Check">func <a href="/target/scryptauthlib.go?s=2609:2663#L68">Check</a></h2>
			<pre>func Check(hmk, h, pw, s []byte) (chk bool, err error)</pre>
			<p>
Check takes an HMAC key, a hash to check, a password and a salt (as byte slices)
scrypt transforms the password and salt, and then HMAC transforms the result.
Compares the resulting 256 bit HMAC hash against the check hash and returns a boolean.
</p>

			
		
			
			
			<h2 id="New">func <a href="/target/scryptauthlib.go?s=3113:3162#L83">New</a></h2>
			<pre>func New(hmk, pw []byte) (h, s []byte, err error)</pre>
			<p>
New takes an HMAC key and a password (as byte slices)
Generates a new salt using &#34;crypto/rand&#34;
scrypt transforms the password and salt, and then HMAC transforms the result.
Returns the resulting 256 bit HMAC hash and 256 bit salt.
</p>

			
		
		
		</div>
	

	







